home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / ada / gnat1792.zip / gnat179b / t-adainc / a-strcon.ads < prev    next >
Text File  |  1994-05-19  |  26KB  |  412 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                         GNAT RUNTIME COMPONENTS                          --
  4. --                                                                          --
  5. --                A D A . S T R I N G S . C O N S T A N T S                 --
  6. --                                                                          --
  7. --                                 S p e c                                  --
  8. --                                                                          --
  9. --                            $Revision: 1.5 $                              --
  10. --                                                                          --
  11. --           Copyright (c) 1992,1993,1994 NYU, All Rights Reserved          --
  12. --                                                                          --
  13. -- GNAT is free software;  you can  redistribute it  and/or modify it under --
  14. -- terms of the  GNU General Public License as published  by the Free Soft- --
  15. -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
  16. -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
  17. -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
  18. -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
  19. -- for  more details.  You should have  received  a copy of the GNU General --
  20. -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
  21. -- to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. --
  22. --                                                                          --
  23. ------------------------------------------------------------------------------
  24.  
  25.  
  26. with Ada.Strings.Maps;
  27. with Ada.Characters.Latin_1; use Ada.Characters.Latin_1;
  28.  
  29. package Ada.Strings.Constants is
  30.  
  31.    Control_Set           : constant Maps.Character_Set;
  32.    Graphic_Set           : constant Maps.Character_Set;
  33.    Letter_Set            : constant Maps.Character_Set;
  34.    Lower_Set             : constant Maps.Character_Set;
  35.    Upper_Set             : constant Maps.Character_Set;
  36.    Basic_Set             : constant Maps.Character_Set;
  37.    Decimal_Digit_Set     : constant Maps.Character_Set;
  38.    Hexadecimal_Digit_Set : constant Maps.Character_Set;
  39.    Alphanumeric_Set      : constant Maps.Character_Set;
  40.    Special_Graphic_Set   : constant Maps.Character_Set;
  41.    ISO_646_Set           : constant Maps.Character_Set;
  42.  
  43.    subtype Full_Character_Map is Maps.Character_Mapping (Character'range);
  44.  
  45.    --  Maps to lower case for letters, else identity
  46.  
  47.    Lower_Case_Map        : constant  Full_Character_Map;
  48.    --  ??? should be defined of the unconstrained type Maps.Character_Mapping
  49.  
  50. private
  51.  
  52.    subtype Cset is Maps.Character_Set (Character'range);
  53.    --  Define constrained subtype so we can use others in aggregates
  54.  
  55.    Control_Set : constant Maps.Character_Set := Cset'(
  56.      NUL .. US                                 => True,
  57.      DEL                                       => True,
  58.      Reserved_128 .. APC                       => True,
  59.      others                                    => False);
  60.  
  61.    Graphic_Set : constant Maps.Character_Set := Cset'(
  62.      NUL .. US                                 => False,
  63.      DEL                                       => False,
  64.      Reserved_128 .. APC                       => False,
  65.      others                                    => True);
  66.  
  67.    Letter_Set : constant Maps.Character_Set := Cset'(
  68.      'A' .. 'Z'                                => True,
  69.      'a' .. 'z'                                => True,
  70.      UC_A_Grave .. UC_O_Diaeresis              => True,
  71.      UC_O_Oblique_Stroke .. LC_O_Diaeresis     => True,
  72.      LC_O_Oblique_Stroke .. LC_Y_Diaeresis     => True,
  73.      others                                    => False);
  74.  
  75.    Lower_Set : constant Maps.Character_Set := Cset'(
  76.      'a' .. 'z'                                => True,
  77.      LC_German_Sharp_S   .. LC_O_Diaeresis     => True,
  78.      LC_O_Oblique_Stroke .. LC_Y_Diaeresis     => True,
  79.      others                                    => False);
  80.  
  81.    Upper_Set : constant Maps.Character_Set := Cset'(
  82.      'A' .. 'Z'                                => True,
  83.      UC_A_Grave          .. UC_O_Diaeresis     => True,
  84.      UC_O_Oblique_Stroke .. UC_Icelandic_Thorn => True,
  85.      others                                    => False);
  86.  
  87.    Basic_Set : constant Maps.Character_Set := Cset'(
  88.      'A' .. 'Z'                                => True,
  89.      'a' .. 'z'                                => True,
  90.      UC_AE_Diphthong                           => True,
  91.      LC_AE_Diphthong                           => True,
  92.      LC_German_Sharp_S                         => True,
  93.      UC_Icelandic_Thorn                        => True,
  94.      LC_Icelandic_Thorn                        => True,
  95.      UC_Icelandic_Eth                          => True,
  96.      LC_Icelandic_Eth                          => True,
  97.      others                                    => False);
  98.  
  99.    Decimal_Digit_Set : constant Maps.Character_Set := Cset'(
  100.      '0' .. '9'                                => True,
  101.      others                                    => False);
  102.  
  103.    Hexadecimal_Digit_Set : constant Maps.Character_Set := Cset'(
  104.      '0' .. '9'                                => True,
  105.      'A' .. 'F'                                => True,
  106.      'a' .. 'f'                                => True,
  107.      others                                    => False);
  108.  
  109.    Alphanumeric_Set : constant Maps.Character_Set := Cset'(
  110.      '0' .. '9'                                => True,
  111.      'A' .. 'Z'                                => True,
  112.      'a' .. 'z'                                => True,
  113.      UC_A_Grave .. UC_O_Diaeresis              => True,
  114.      UC_O_Oblique_Stroke .. LC_O_Diaeresis     => True,
  115.      LC_O_Oblique_Stroke .. LC_Y_Diaeresis     => True,
  116.      others                                    => False);
  117.  
  118.    Special_Graphic_Set : constant Maps.Character_Set := Cset'(
  119.      Space .. Solidus                          => True,
  120.      Colon .. Commercial_At                    => True,
  121.      Left_Square_Bracket .. Grave              => True,
  122.      Left_Curly_Bracket  .. Tilde              => True,
  123.      No_Break_Space      .. Inverted_Question  => True,
  124.      Multiplication_Sign                       => True,
  125.      Division_Sign                             => True,
  126.      others                                    => False);
  127.  
  128.    ISO_646_Set : constant Maps.Character_Set := Cset'(
  129.      Character'Val (0) .. Character'Val (127)  => True,
  130.      others                                    => False);
  131.  
  132.    Lower_Case_Map : constant Full_Character_Map := Full_Character_Map'(
  133.  
  134.      NUL                         => NUL,                           -- 0
  135.      SOH                         => SOH,                           -- 1
  136.      STX                         => STX,                           -- 2
  137.      ETX                         => ETX,                           -- 3
  138.      EOT                         => EOT,                           -- 4
  139.      ENQ                         => ENQ,                           -- 5
  140.      ACK                         => ACK,                           -- 6
  141.      BEL                         => BEL,                           -- 7
  142.      BS                          => BS,                            -- 8
  143.      HT                          => HT,                            -- 9
  144.      LF                          => LF,                            -- 10
  145.      VT                          => VT,                            -- 11
  146.      FF                          => FF,                            -- 12
  147.      CR                          => CR,                            -- 13
  148.      SO                          => SO,                            -- 14
  149.      SI                          => SI,                            -- 15
  150.  
  151.      DLE                         => DLE,                           -- 16
  152.      DC1                         => DC1,                           -- 17
  153.      DC2                         => DC2,                           -- 18
  154.      DC3                         => DC3,